package com.paradogs.framework.core.msg;

import com.baidu.bjf.remoting.protobuf.annotation.ProtobufClass;
import com.paradogs.framework.common.entity.Inventory;
import com.paradogs.framework.common.entity.Role;
import com.paradogs.framework.core.utils.ProtoUtils;
import lombok.Data;
import lombok.ToString;

/**
 * @author: yumi
 * @date: 2023/11/30  16:46
 * @Description: SyncData 客户端统一返回
 */
@Data
@ProtobufClass
public class R {

    private Long playerId;

    /**
     * 回复数据
     */
    private byte[] replyData;

    /**
     * 数据变化时的同步数据
     */
    private Role role;

    private Inventory inventory;


    public R() {}
    public R(byte[] data) {
        this.replyData = data;
    }


    public static <T> R success(T data) {
        return new R(ProtoUtils.encode(data));
    }

}
